using System.Collections;
using NodeCanvas.Variables;
using UnityEngine;

namespace NodeCanvas.Actions
{
	[Category("✫ Blackboard")]
	public class ShuffleList : ActionTask
	{
		[VariableType(typeof(IList))]
		[RequiredField]
		public BBVar targetList;

		protected override void OnExecute()
		{
			IList list = targetList.value as IList;
			for (int num = list.Count - 1; num > 0; num--)
			{
				int index = (int)Mathf.Floor(Random.value * (float)(num + 1));
				object value = list[num];
				list[num] = list[index];
				list[index] = value;
			}
			EndAction();
		}
	}
}
